package com.company.demo.handlers;

import com.company.demo.bean.Student;
import com.company.demo.service.ISomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//@RestController//返回页面路径
@Controller//返回页面资源
@RequestMapping("/test")
public class SomeHandlers {

    @Autowired
    private ISomeService service;

    @RequestMapping("/register")
    public String registerHandle(Student student, Model model){

        model.addAttribute("name",student.getName());
        model.addAttribute("age",student.getAge());

        service.addStudent(student);

        return "jsp/welcome";
    }
}
